using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using BusinessLayer;

namespace DeAn_LapTrinhCSDL.Report
{
    public partial class rpPNhap : DevExpress.XtraReports.UI.XtraReport
    {
        XuLy xl;
        CTPNhap ctpn;
        public rpPNhap()
        {
            InitializeComponent();
            xl = new XuLy();
            xl.connect.ConnectionString = Program.strConnect;
            ctpn = new CTPNhap();
            ctpn.connect.ConnectionString = Program.strConnect;
        }
        private void DetailReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            DetailReport.DataSource = ctpn.GetData(GetCurrentColumnValue("SOPN").ToString());
        }

        private void xrTableCell_TongCong_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            try
            {
                xrTableCell_TongCong.Text = "0";
                double a = Convert.ToDouble(xrTableCell_TongSLNhap.Summary.GetResult().ToString());
                double b = Convert.ToDouble(xrTableCell_TongDGNhap.Summary.GetResult().ToString());
                xrTableCell_TongCong.Text = Convert.ToString(a * b);
            }
            catch (Exception)
            {
                //throw;
            }
        }

        private void xrLabel_NgayThang_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            xrLabel_NgayThang.Text = xl.ConvertToVietnameseDateTime(DateTime.Now);
        }
    }
}
